# $Id: PKGBUILD 137878 2011-09-12 06:26:48Z eric $
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=ogle
pkgver=0.9.2
pkgrel=13
pkgdesc="A simple DVD player for Linux"
arch=('i686' 'x86_64')
url="http://www.dtek.chalmers.se/groups/dvd/"
license=('GPL')
depends=('sh' 'libxml2' 'libdvdread' 'libjpeg' 'libmad' 'libxinerama' 'libxv'
         'alsa-lib' 'a52dec' 'libxxf86vm')
options=('!libtool')
# http://www.dtek.chalmers.se/groups/dvd/dist/${pkgname}-${pkgver}.tar.gz
source=(ftp://ftp.archlinux.org/other/ogle/${pkgname}-${pkgver}.tar.gz \
        xvideofix.patch	gcc34alsafix.patch gcc4.patch dvdread-4.1.3.patch \
        ogle-vuln-scripts-makefile.patch)
md5sums=('a76a9892bdb807a4bcf859d15a91f0f9'
         '57f1cf36eed82c56f24e9c0fc25ce2b3'
         '4ebc822b252fade6b53c5ceb5be45bf5'
         'd08cff87c5ec41a7eebc0d2384835688'
         '597906c64ff7f5185de8430fdae3107d'
         'd052b01f293c61d399fdd0ac2abb1cf4')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p0 -i "${srcdir}/dvdread-4.1.3.patch"
  patch -p1 -i "${srcdir}/xvideofix.patch"
  patch -p1 -i "${srcdir}/gcc34alsafix.patch"
  patch -p1 -i "${srcdir}/gcc4.patch"
  patch -p0 -i "${srcdir}/ogle-vuln-scripts-makefile.patch"

   # fix alsa detection - stolen from their cvs
  sed -i 's|^.*MINOR\=\=5.*$|#if SND_LIB_MAJOR==0 && SND_LIB_MINOR<6|' configure
  sed -i 's|__diga_end:|\0;|' libogleao/alsa_audio.c
  ./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --with-x
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  export LIBRARY_PATH="${pkgdir}/usr/lib/ogle"
  make DESTDIR="${pkgdir}" install
}
